package com.ruoyi.app.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.suggest.domain.CrmSuggest;
import com.ruoyi.suggest.service.ICrmSuggestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 维修Controller
 * 
 * @author hct
 * @date 2022-02-11
 */
@RestController
@RequestMapping("/app/suggest")
public class AppSuggestController extends BaseController
{
    @Autowired
    private ICrmSuggestService crmSuggestService;

    /**
     * 查询维修列表
     */
    @GetMapping("/list")
    public TableDataInfo list(CrmSuggest crmSuggest)
    {
        startPage();
        List<CrmSuggest> list = crmSuggestService.selectCrmSuggestList(crmSuggest);
        return getDataTable(list);
    }

    /**
     * 获取维修详细信息
     */
    @GetMapping(value = "/detail/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(crmSuggestService.selectCrmSuggestById(id));
    }

    /**
     * 新增维修
     */
    @PostMapping(value = "/add")
    public AjaxResult add(@RequestBody CrmSuggest crmSuggest)
    {
        return toAjax(crmSuggestService.insertCrmSuggest(crmSuggest));
    }

    /**
     * 修改维修
     */
    @PutMapping(value = "/edit")
    public AjaxResult edit(@RequestBody CrmSuggest crmSuggest)
    {
        return toAjax(crmSuggestService.updateCrmSuggest(crmSuggest));
    }



    /**
     * 删除维修
     */
  	@DeleteMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(crmSuggestService.deleteCrmSuggestByIds(ids));
    }
}
